<?php 
class BackupController extends Controller{
	public function __init(){

	}
	public function index(){
		$this->display();
	}

	public function backup(){
		$result = Backup::backup(
	            array(
	                "size" => 200,//每个卷多大,单位是KB
	                "dir" => C("DB_BACKUP")  . date("Ymdhis")
	            )
	        );
	        if ($result['status'] == 'success') {
	            $this->success($result['message'], U('index'));
	        } else {
	            $this->success($result['message'], $result['url'], 0.2);
	        }
	}

	public function backupList(){
		$dirs = Dir::tree('Backup');  //遍历Backup目录
		// p($dirs);exit;
		$this->assign('dirs',$dirs);
		$this->display();
	}

	public function recovery(){
		$dir = C("DB_BACKUP") . Q("dir");
	        $result = Backup::recovery(array('dir' => $dir));
	        if ($result['status'] == 'success') {
	            $this->success($result['message'], U('index'));
	        } else {
	            $this->success($result['message'], $result['url'], 0.2);
	        }

	}

	public function delete(){
		
	}



}


?>